<template>
  <div id="slideshow">
    <div class="swiper-container myimg">
      <div class="swiper-wrapper">
        <div class="swiper-slide" v-for="(item, index) in list" :key="index">
          <img :src="item.img" alt srcset />
        </div>
      </div>
      <!-- 分页器 -->
      <div class="swiper-pagination"></div>
    </div>
  </div>
</template>

<script>
import Swiper from 'swiper'

export default {
  name: 'slideshow',
  props: ['list'],
  data () {
    return {
    }
  },
  mounted () {
    var mySwiper = new Swiper('.swiper-container', {
      autoplay: {
        delay: 2000,
        disableOnInteraction: false
      },
      direction: 'horizontal',
      loop: true,

      pagination: {
        el: '.swiper-pagination'
      }
    })
    return mySwiper
  }
}
</script>

<style scoped lang="less">
#slideshow {
  width: 100%;
  overflow: hidden;
  .myimg {
    width: 90%;
    margin: 20px 5%;
    overflow: hidden;
    border-radius: 25px;
    img {
      height: 300px;
      width: 100%;
    }
  }
}
</style>
